<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>FLjoy</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="FLhvsBoxSetValue.html" title="FLhvsBoxSetValue" />
    <link rel="next" href="FLkeyIn.html" title="FLkeyIn" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">FLjoy</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="FLhvsBoxSetValue.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="FLkeyIn.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="FLjoy"></a>
      <div class="titlepage"></div>
      <a id="IndexFLjoy" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">FLjoy</span>
        </h2>
        <p>FLjoy — 
      A FLTK opcode that acts like a joystick. 
          </p>
      </div>
      <div class="refsect1">
        <a id="idp104661984"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>FLjoy</em></span> is a squared area that allows the user to modify two output values at the same time. It acts like a joystick. 
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104663872"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">koutx, kouty, ihandlex, ihandley <span class="command"><strong>FLjoy</strong></span> "label", iminx, imaxx, iminy, \
      imaxy, iexpx, iexpy, idispx, idispy, iwidth, iheight, ix, iy</pre>
      </div>
      <div class="refsect1">
        <a id="idp104731120"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ihandlex</em></span> -- a handle value (an integer number) that unequivocally references a corresponding widget. Used by further opcodes that changes some valuator's properties. It is automatically set by the corresponding valuator.
    </p>
        <p>
      <span class="emphasis"><em>ihandley</em></span> -- a handle value (an integer number) that unequivocally references a corresponding widget. Used by further opcodes that changes some valuator's properties. It is automatically set by the corresponding valuator.
    </p>
        <p>
      <span class="emphasis"><em><span class="quote">“<span class="quote">label</span>”</span></em></span> -- a double-quoted string containing some user-provided text, placed near the corresponding widget.
    </p>
        <p>
      <span class="emphasis"><em>iminx</em></span> -- minimum x value of output range
    </p>
        <p>
      <span class="emphasis"><em>imaxx</em></span> -- maximum x value of output range
    </p>
        <p>
      <span class="emphasis"><em>iminy</em></span> -- minimum y value of output range
    </p>
        <p>
      <span class="emphasis"><em>imaxy</em></span> -- maximum y value of output range
    </p>
        <p>
      <span class="emphasis"><em>iwidth</em></span> -- width of widget.
    </p>
        <p>
      <span class="emphasis"><em>idispx</em></span> -- a handle value that was output from a previous instance of the <a class="link" href="FLvalue.html" title="FLvalue"><em class="citetitle">FLvalue</em></a> opcode to display the current value of the current valuator in the <span class="emphasis"><em>FLvalue</em></span> widget itself. If the user doesn't want to use this feature that displays current values, it must be set to a negative number by the user.
    </p>
        <p>
      <span class="emphasis"><em>idispy</em></span> -- a handle value that was output from a previous instance of the <a class="link" href="FLvalue.html" title="FLvalue"><em class="citetitle">FLvalue</em></a> opcode to display the current value of the current valuator in the <span class="emphasis"><em>FLvalue</em></span> widget itself. If the user doesn't want to use this feature that displays current values, it must be set to a negative number by the user.
    </p>
        <p>
      <span class="emphasis"><em>iexpx</em></span> -- an integer number denoting the behaviour of valuator: 
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>0 = valuator output is linear</p>
            </li>
            <li class="listitem">
              <p>-1 = valuator output is exponential</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      All other positive numbers for <span class="emphasis"><em>iexpx</em></span> indicate the number of an existing table that is used for indexing. Linear interpolation is provided in table indexing. A negative table number suppresses interpolation. 
    </p>
        <p>
      <span class="emphasis"><em>iexpy</em></span> -- an integer number denoting the behaviour of valuator: 
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>0 = valuator output is linear</p>
            </li>
            <li class="listitem">
              <p>-1 = valuator output is exponential</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      All other positive numbers for <span class="emphasis"><em>iexpy</em></span> indicate the number of an existing table that is used for indexing. Linear interpolation is provided in table indexing. A negative table number suppresses interpolation. 
    </p>
        <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning: IMPORTANT!">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">IMPORTANT!</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        Notice that the tables used by valuators must be created with the <a class="link" href="ftgen.html" title="ftgen"><em class="citetitle">ftgen</em></a> opcode and placed in the orchestra before the corresponding valuator. They can not placed in the score. In fact, tables placed in the score are created later than the initialization of the opcodes placed in the header section of the orchestra.
      </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
      <span class="emphasis"><em>iheight</em></span> -- height of widget.
    </p>
        <p>
      <span class="emphasis"><em>ix</em></span> -- horizontal position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
    </p>
        <p>
      <span class="emphasis"><em>iy</em></span> -- vertical position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104758784"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>koutx</em></span> -- x output value
    </p>
        <p>
      <span class="emphasis"><em>kouty</em></span> -- y output value
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104761376"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the FLjoy opcode. It uses the file <a class="ulink" href="examples/FLjoy.csd" target="_top"><em class="citetitle">FLjoy.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp104763232"></a>
          <p class="title">
            <strong>Example 267. Example of the FLjoy opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o FLjoy.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Demonstration of the flpanel opcode</span>
<span class="comment">; Horizontal click-dragging controls the frequency of the oscillator</span>
<span class="comment">; Vertical click-dragging controls the amplitude of the oscillator</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 441
<span class="ohdr">ksmps</span> <span class="op">=</span> 100
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="opc">FLpanel</span> "X Y Panel", 900, 400, 50, 50
    <span class="comment">; Minimum value output by x movement (frequency)</span>
    iminx <span class="op">=</span> 200
    <span class="comment">; Maximum value output by x movement (frequency)</span>
    imaxx <span class="op">=</span> 5000 
    <span class="comment">; Minimum value output by y movement (amplitude)</span>
    iminy <span class="op">=</span> 0
    <span class="comment">; Maximum value output by y movement (amplitude)</span>
    imaxy <span class="op">=</span> 15000
    <span class="comment">; Logarithmic change in x direction</span>
    iexpx <span class="op">=</span> <span class="op">-</span>1
    <span class="comment">; Linear change in y direction</span>
    iexpy <span class="op">=</span> 0
    <span class="comment">; Display handle x direction (-1=not used)</span>
    idispx <span class="op">=</span> <span class="op">-</span>1
    <span class="comment">; Display handle y direction (-1=not used)</span>
    idispy <span class="op">=</span> <span class="op">-</span>1
    <span class="comment">; Width of the x y panel in pixels</span>
    iwidth <span class="op">=</span> 800
    <span class="comment">; Height of the x y panel in pixels</span>
    iheight <span class="op">=</span> 300
    <span class="comment">; Distance of the left edge of the x y panel from </span>
    <span class="comment">; the left edge of the panel</span>
    ix <span class="op">=</span> 50
    <span class="comment">; Distance of the top edge of the x y </span>
    <span class="comment">; panel from the top edge of the panel</span>
    iy <span class="op">=</span> 50

    gkfreqx, gkampy, ihandlex, ihandley <span class="opc">FLjoy</span> "X <span class="op">-</span> Frequency Y <span class="op">-</span> Amplitude", iminx, imaxx, iminy, imaxy, iexpx, iexpy, idispx, idispy, iwidth, iheight, ix, iy
<span class="comment">; End of panel contents</span>
<span class="opc">FLpanelEnd</span>
<span class="comment">; Run the widget thread!</span>
<span class="opc">FLrun</span>

<span class="oblock">instr</span> 1
    ifn <span class="op">=</span> 1
    asig <span class="opc">oscili</span> gkampy, gkfreqx, ifn
    <span class="opc">out</span> asig
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Function table that defines a single cycle</span>
<span class="comment">; of a sine wave.</span>
<span class="stamnt">f</span> 1 0 1024 10 1

<span class="comment">; Instrument 1 will play a note for 1 hour.</span>
<span class="stamnt">i</span> 1 0 3600
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104767552"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="FLcount.html" title="FLcount"><em class="citetitle">FLcount</em></a>,
      <a class="link" href="FLknob.html" title="FLknob"><em class="citetitle">FLknob</em></a>,
      <a class="link" href="FLroller.html" title="FLroller"><em class="citetitle">FLroller</em></a>,
      <a class="link" href="FLslider.html" title="FLslider"><em class="citetitle">FLslider</em></a>,
      <a class="link" href="FLtext.html" title="FLtext"><em class="citetitle">FLtext</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104773504"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>New in version 4.22</p>
        <p>Example written by Iain McCurdy, edited by Kevin Conder.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="FLhvsBoxSetValue.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="FLkeyIn.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">FLhvsBoxSetValue </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> FLkeyIn</td>
        </tr>
      </table>
    </div>
  </body>
</html>
